package org.ant.gui.panes;

import java.awt.GridBagLayout;

import javax.swing.JPanel;
import javax.swing.JTextArea;

import org.ant.ctrl.CodesManager;
import org.ant.gui.layout.GBC;

public class TACPane extends JPanel {

	public static String NAME = "TAC Output";
	private String output;
	private JTextArea area;

	public TACPane() {
		setName(NAME);
		init();
	}

	protected void init() {
		this.setLayout(new GridBagLayout());
		area = new JTextArea();
		add(area, new GBC(0, 0).setWeight(1, 1).setFill(GBC.BOTH));
	}

	public String getOutput() {
		return output;
	}

	public void setOutput(String output) {
		this.output = output;
		area.setText(output);
	}

	public void update() {
		area.setText("No Code Generated");
		setOutput(CodesManager.getInstane().getCurrentCode().getOutput());
	}
}
